#include <OTimer.h>

void OTimer::Start(u16 t)
{
	Time=t;
	pthread_create(&pid,NULL,Run,this);
}

void OTimer::Stop()
{
	pthread_cancel(pid);
	pthread_join(pid,NULL);
}

void *OTimer::Run(void *arg)
{
	OTimer *tmp=(OTimer *)arg;
	while(tmp->Time--)
		msleep(1);
	tmp->Invoke();
}
